package com.micro.ai.models.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 微调模型实体类
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("fine_tuned_models")
@Schema(description = "微调模型信息")
public class FineTunedModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "模型ID", example = "ftm_123456789")
    private String id;

    /**
     * 租户ID
     */
    @Schema(description = "租户ID", example = "tenant_001", required = true)
    private String tenantId;

    /**
     * 对应的训练任务ID
     */
    @Schema(description = "对应的训练任务ID", example = "job_123", required = true)
    private String jobId;

    /**
     * 模型名称
     */
    @Schema(description = "模型名称", example = "gpt-4-chinese-dialog", required = true)
    private String modelName;

    /**
     * 模型别名
     */
    @Schema(description = "模型别名", example = "中文对话GPT-4")
    private String modelAlias;

    /**
     * 基础模型ID
     */
    @Schema(description = "基础模型ID", example = "model_123", required = true)
    private String baseModelId;

    /**
     * 模型描述
     */
    @Schema(description = "模型描述", example = "针对中文对话场景微调的GPT-4模型")
    private String description;

    /**
     * 模型文件路径
     */
    @Schema(description = "模型文件路径", example = "/models/gpt4-chinese-dialog")
    private String modelPath;

    /**
     * 模型文件大小
     */
    @Schema(description = "模型文件大小（字节）", example = "2147483648")
    private Long modelSize;

    /**
     * 模型格式
     */
    @Schema(description = "模型格式", example = "external", allowableValues = {"safetensors", "bin", "external"})
    private String modelFormat;

    /**
     * 评估结果（JSON）
     */
    @Schema(description = "评估结果（JSON格式）", example = "{\"accuracy\":0.95}")
    private String evalResults;

    /**
     * 状态
     */
    @Schema(description = "状态", example = "active", allowableValues = {"trained", "deploying", "active", "inactive", "archived"})
    private String status;
    
    
    @Schema(description = "状态", example = "active", allowableValues = {"trained", "deploying", "active", "inactive", "archived"})
    private String errorMessage;

    /**
     * 部署时间
     */
    @Schema(description = "部署时间", example = "2025-01-01 02:00:00")
    private LocalDateTime deployedAt;

    /**
     * 训练成本
     */
    @Schema(description = "训练成本（美元）", example = "12.50")
    private BigDecimal trainingCost;

    /**
     * 每日存储成本
     */
    @Schema(description = "每日存储成本（美元）", example = "0.05")
    private BigDecimal storageCostPerDay;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID", example = "1001", required = true)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2025-01-01 00:00:00")
    private LocalDateTime updatedAt;
}
